#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int main()
{
	int arr[] = { 1,2,3,4,5,6,7,8,9 };
	int left = 0;
	int right = sizeof(arr) / sizeof(arr[0])-1;
	
	while (left < right)
	{
		int tmp = 0;
		if ((arr[left] & 1 )== 0)
		{
			tmp = arr[left];
			arr[left] = arr[right];
			arr[right] = tmp;
			right--;
		}
		else
		{
			left++;
		}
		/*if ((left < right) && arr[left] % 2 == 1)
		{
			left++;
		}
		if ((left <right) && arr[right] % 2 == 0)
		{
			right--;
		}
		if (left < right)
		{
			tmp = arr[left];
			arr[left] = arr[right];
			arr[right] = tmp;
		}
	}*/
	}
	int i = 0;
	for (i = 0; i < 9; i++)
	{
		printf("%d ", arr[i]);
	}
	return 0;
}